#ifndef DATABASE_MANAGER_P_H
#define DATABASE_MANAGER_P_H

#include <QtCore/QList>
#include <QtCore/QMutex>
#include "dbmanager/database_manager.h"

namespace dbmanager {

class QueryHandler;
class DatabaseManager;

class DatabaseManagerPrivate : public QObject {
  Q_OBJECT
public:

  DatabaseManagerPrivate(const QString &db_host,
                         quint16 db_port,
                         const QString &db_name,
                         const QString &db_user,
                         const QString &db_pass,
                         int num_connect_db,
                         const QString &name_prefix);

  ~DatabaseManagerPrivate();

signals:

  void newQuery();

private:

  void faultExecute(int code);

  friend class QueryHandler;
  friend class DatabaseManager;

  QList<SqlQuery *> queries;

  QList<QueryHandler *> handlers;

  int executed_success;

  QHash<int, int> executed_fault;

  QString db_host;
  quint16 db_port;
  QString db_name;
  QString db_user;
  QString db_pass;
  int num_connect_db;
  QString name_prefix;

  QMutex mutex;
};

} // namespace dbmanager

#endif // DATABASE_MANAGER_P_H
